﻿<Window x:Class="Microsoft.Samples.Kinect.ControlsBasics.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:k="http://schemas.microsoft.com/kinect/2013"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Microsoft.Samples.Kinect.ControlsBasics"
        Name="ControlsBasicsWindow"
        Title="Controls Basics"
        Closing="WindowClosing"
        mc:Ignorable="d"
        d:DesignWidth="1200"
        d:DesignHeight="700"
        MinWidth="500"
        MinHeight="700"
        FontFamily="Segoe UI"
        >
    
<Window.Resources>
        <PathGeometry x:Key="ChevronGeometry" x:Shared="False">
            F1M150.001,146.9932L126.565,169.3822L126.565,153.5962L150.001,130.6182L173.435,153.5962L173.435,169.3822z
        </PathGeometry>

        <Path x:Key="ChevronUp" Height="48" Width="48" Stretch="Uniform" Canvas.Top="0" x:Shared="False"
          Data="{StaticResource ChevronGeometry}"
          Fill="{Binding FallbackValue=Black, Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type local:KinectHoverButton}}}">
            <Path.RenderTransformOrigin>0.5,0.5</Path.RenderTransformOrigin>
            <Path.RenderTransform>
                <RotateTransform Angle="0"/>
            </Path.RenderTransform>
        </Path>

        <Path x:Key="ChevronRight" Height="48" Width="48" Stretch="Uniform" Canvas.Top="0" x:Shared="False"
          Data="{StaticResource ChevronGeometry}"
          Fill="{Binding FallbackValue=Black, Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type local:KinectHoverButton}}}">
            <Path.RenderTransformOrigin>0.5,0.5</Path.RenderTransformOrigin>
            <Path.RenderTransform>
                <RotateTransform Angle="90"/>
            </Path.RenderTransform>
        </Path>

        <Path x:Key="ChevronDown" Height="48" Width="48" Stretch="Uniform" Canvas.Top="0" x:Shared="False"
          Data="{StaticResource ChevronGeometry}"
          Fill="{Binding FallbackValue=Black, Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type local:KinectHoverButton}}}">
            <Path.RenderTransformOrigin>0.5,0.5</Path.RenderTransformOrigin>
            <Path.RenderTransform>
                <RotateTransform Angle="180"/>
            </Path.RenderTransform>
        </Path>

        <Path x:Key="ChevronLeft" Height="48" Width="48" Stretch="Uniform" Canvas.Top="0" x:Shared="False"
          Data="{StaticResource ChevronGeometry}"
          Fill="{Binding FallbackValue=Black, Path=Foreground,RelativeSource={RelativeSource AncestorType={x:Type local:KinectHoverButton}}}">
            <Path.RenderTransformOrigin>0.5,0.5</Path.RenderTransformOrigin>
            <Path.RenderTransform>
                <RotateTransform Angle="270"/>
            </Path.RenderTransform>
        </Path>

        <Style x:Key="KinectHoverButtonStyle" TargetType="{x:Type local:KinectHoverButton}">
            <Setter Property="Background" Value="LightGray"/>
            <Setter Property="BorderBrush" Value="DarkGray"/>
            <Setter Property="BorderThickness" Value="0"></Setter>
            <Setter Property="Foreground" Value="White"></Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type local:KinectHoverButton}">
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                            <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                                <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="{TemplateBinding Content}"></ContentPresenter>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Foreground" Value="LightGray"/>
                    <Setter Property="BorderBrush" Value="LightGray"/>
                    <Setter Property="Background" Value="Transparent"></Setter>
                </Trigger>
                <Trigger Property="IsHandPointerOver" Value="True">
                    <Setter Property="Background" Value="#5A5B5B"/>
                    <Setter Property="Foreground" Value="White"/>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="KinectHoverButtonScrollUpStyle" TargetType="{x:Type local:KinectHoverButton}" BasedOn="{StaticResource KinectHoverButtonStyle}">
            <Setter Property="Content" Value="{StaticResource ChevronUp}"/>
        </Style>

        <Style x:Key="KinectHoverButtonScrollRightStyle" TargetType="{x:Type local:KinectHoverButton}" BasedOn="{StaticResource KinectHoverButtonStyle}">
            <Setter Property="Content" Value="{StaticResource ChevronRight}"/>
        </Style>

        <Style x:Key="KinectHoverButtonScrollDownStyle" TargetType="{x:Type local:KinectHoverButton}" BasedOn="{StaticResource KinectHoverButtonStyle}">
            <Setter Property="Content" Value="{StaticResource ChevronDown}"/>
        </Style>

        <Style x:Key="KinectHoverButtonScrollLeftStyle" TargetType="{x:Type local:KinectHoverButton}" BasedOn="{StaticResource KinectHoverButtonStyle}">
            <Setter Property="Content" Value="{StaticResource ChevronLeft}"/>
        </Style>
    </Window.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0"  Margin="10 0 10 20">
            <Image HorizontalAlignment="Left" VerticalAlignment="Bottom" Source="Images\Logo.png" Stretch="None" Margin="0 0 0 4"/>
            <k:KinectUserViewer k:KinectRegion.KinectRegion="{Binding ElementName=kinectRegion}" Height="100" HorizontalAlignment="Center" VerticalAlignment="Top" />
            <k:KinectSensorChooserUI HorizontalAlignment="Center" VerticalAlignment="Top" Name="sensorChooserUi" />
            <TextBlock HorizontalAlignment="Right" Margin="0 0 -1 0" VerticalAlignment="Bottom" Foreground="{StaticResource MediumGreyBrush}" FontSize="18">Controls Basics</TextBlock>
        </Grid>

        <k:KinectRegion Grid.Row="1" x:Name="kinectRegion">
            <Grid x:Name="kinectRegionGrid" Margin="10,20,10,20">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="170" />
                </Grid.RowDefinitions>
                <k:KinectScrollViewer Grid.Row="0" Name="scrollViewer" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">
                    <WrapPanel VerticalAlignment="Center" x:Name="wrapPanel" Orientation="Vertical" k:KinectTileButton.Click="KinectTileButtonClick">
                        <!-- items for design layout.  They will be replaced at runtime. -->
                        <k:KinectTileButton Label="1"/>
                        <k:KinectTileButton Label="2"/>
                        <k:KinectTileButton Label="3"/>
                        <k:KinectTileButton Label="4"/>
                        <k:KinectTileButton Label="5"/>
                        <k:KinectTileButton Label="6"/>
                        <k:KinectTileButton Label="7"/>
                        <k:KinectTileButton Label="8"/>
                        <k:KinectTileButton Label="9"/>
                        <k:KinectTileButton Label="10"/>
                    </WrapPanel>
                </k:KinectScrollViewer>
                <Grid Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0, 10, 0, 10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="10"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <local:KinectHoverButton Grid.Column="0" Style="{StaticResource KinectHoverButtonScrollLeftStyle}" Click="PageLeftButtonClick" IsEnabled="{Binding ElementName=ControlsBasicsWindow, Path=PageLeftEnabled}"/>
                    <local:KinectHoverButton Grid.Column="2" Style="{StaticResource KinectHoverButtonScrollRightStyle}" Click="PageRightButtonClick" IsEnabled="{Binding ElementName=ControlsBasicsWindow, Path=PageRightEnabled}"/>
                </Grid>
            </Grid>
        </k:KinectRegion>
    </Grid>
</Window>
